package com.hddz.acquisition.fragment.stock;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.TextView;

import com.hddz.acquisition.R;
import com.hddz.acquisition.fragment.BaseFragment;
import com.hddz.acquisition.model.JsonRespose;
import com.hddz.acquisition.view.MessageAdapter;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

@ContentView(R.layout.view_stock_armshaft_scan)
public class FragmentGroundingScan extends BaseFragment {

	@ViewInject(R.id.txt_target_ware_house)
	private TextView txt_target_ware_house;

	@ViewInject(R.id.txt_source_ware_house)
	private TextView txt_source_ware_house;

	@ViewInject(R.id.txt_total_horse)
	private TextView txt_total_horse;

	@ViewInject(R.id.txt_total_quantity)
	private TextView txt_total_quantity;

	@ViewInject(R.id.txt_total_free1)
	private TextView txt_total_price;

	@ViewInject(R.id.txt_barcode)
	private TextView txt_barcode;

	@ViewInject(R.id.cb_unActive)
	public CheckBox cb_unActive;

	@ViewInject(R.id.list)
	private ListView list;

	private MessageAdapter adapter;

	public static FragmentGroundingScan newInstance() {
		FragmentGroundingScan fragment = new FragmentGroundingScan();
		return fragment;
	}


	@Override
	public void appandChild(View view) {

		adapter = new MessageAdapter(getActivity(), list);
		list.setAdapter(adapter);
	}


	public void updateResponse(JsonRespose json) {
		txt_target_ware_house.setText(json.response.cTargetWarehouse);
		txt_source_ware_house.setText(json.response.cSourceWarehouse);
		txt_total_horse.setText(json.response.iTotalHorse + "");
		txt_total_quantity.setText(json.response.iTotalQuantity + "");
//		txt_total_free1.setText(json.response.iTotalFree1 + "");
	}

	public void updateBarcode(String barcode) {
		txt_barcode.setText(barcode);
	}

	public void updatePrice(String price){
		txt_total_price.setText(price);
	}

	public void appandMsg(String msg) {
		adapter.appandItem(msg);
	}

}
